Skip to content

Automated Test: insights-performance-optimization #362

Conversation

admin-coderabbit
Copy link
Owner

@admin-coderabbit admin-coderabbit commented Feb 4, 2026

This pull request was automatically created by @coderabbitai/e2e-reviewer.

Batch created pull request.

Summary by CodeRabbit

  • Refactor

    • Refactored InsightsBookingService condition handling mechanisms.
  • Tests

    • Updated booking insights integration tests to align with refactored architecture.

…22345)

* fix: use raw query at InsightsBookingService

* feat: convert InsightsBookingService to use Prisma.sql raw queries

- Convert auth conditions from Prisma object notation to Prisma.sql
- Convert filter conditions from Prisma object notation to Prisma.sql
- Update return types from Prisma.BookingTimeStatusDenormalizedWhereInput to Prisma.Sql
- Fix type error in isOrgOwnerOrAdmin method
- Follow same pattern as InsightsRoutingService conversion

Co-Authored-By: eunjae@cal.com <hey@eunjae.dev>

* feat: convert InsightsBookingService to use Prisma.sql raw queries

- Convert auth conditions from Prisma object notation to Prisma.sql
- Convert filter conditions from Prisma object notation to Prisma.sql
- Update return types from Prisma.BookingTimeStatusDenormalizedWhereInput to Prisma.Sql
- Fix type error in isOrgOwnerOrAdmin method
- Follow same pattern as InsightsRoutingService conversion

Co-Authored-By: eunjae@cal.com <hey@eunjae.dev>

* fix: update InsightsBookingService integration tests for Prisma.sql format

- Replace Prisma object notation expectations with Prisma.sql template literals
- Add NOTHING_CONDITION constant for consistency with InsightsRoutingService
- Update all test cases to use direct Prisma.sql comparisons
- Use $queryRaw for actual database integration testing
- Follow same testing patterns as InsightsRoutingService

Co-Authored-By: eunjae@cal.com <hey@eunjae.dev>

* fix: exclude intentionally skipped jobs from required CI check failure

- Remove 'skipped' from failure condition in pr.yml and all-checks.yml
- Allow E2E jobs to be skipped without failing the required check
- Only actual failures and cancelled jobs will cause required check to fail

Co-Authored-By: eunjae@cal.com <hey@eunjae.dev>

* fix tests

* Revert "fix: exclude intentionally skipped jobs from required CI check failure"

This reverts commit 6ff44fc9a8f14ad657f7bba7c2e454e192b66c8f.

* clean up tests

* address feedback

---------

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@coderabbit-eval
Copy link

coderabbit-eval bot commented Feb 4, 2026

📝 Walkthrough

Walkthrough

The InsightsBookingService class was refactored to use Prisma SQL fragments (Prisma.Sql) instead of where-input objects for building authorization and filter conditions. The findMany method was renamed to getBaseConditions, and all condition-building methods now return SQL fragments. Tests were correspondingly updated to expect and verify SQL fragment outputs.

Changes

Cohort / File(s) Summary
SQL Fragment Refactoring
packages/lib/server/service/insightsBooking.ts
Refactored condition-building logic from Prisma where-input objects to SQL fragments. Introduced new public type InsightsBookingServicePublicOptions. Renamed findMany to getBaseConditions with return type Promise<Prisma.Sql>. Updated getAuthorizationConditions, getFilterConditions, buildFilterConditions, and buildAuthorizationConditions to return Prisma.Sql instead of where-input objects. Introduced NOTHING_CONDITION constant (Prisma.sql\1=0``). Changed condition composition from object-based to SQL-level concatenation.
Test Updates
packages/lib/server/service/__tests__/insightsBooking.integration-test.ts
Updated integration tests to use Prisma SQL fragment expectations instead of plain JS objects. Tests now invoke getBaseConditions and execute queries via prisma.$queryRaw. Added NOTHING_CONDITION constant and updated cleanup and assertion logic to match SQL fragment representations.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 From objects nested deep we hop away,
SQL fragments dance in brand new way!
Conditions built with SQL's own tongue,
Refactored methods, fresh and young,
Authorization flows now pure and bright!

🚥 Pre-merge checks | ✅ 1 | ❌ 1
❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'Automated Test: insights-performance-optimization' is vague and does not clearly describe the actual changes made. The PR refactors InsightsBookingService to use Prisma SQL fragments instead of JS objects, but the title suggests only test automation without conveying this core architectural change. Consider using a more descriptive title like 'Refactor InsightsBookingService to use Prisma SQL fragments' that accurately reflects the primary code changes and their purpose.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch insights-performance-optimization

Comment @coderabbit eval help to get the list of available commands and usage tips.

@coderabbit-eval coderabbit-eval bot closed this Feb 4, 2026
Sign in to join this conversation on GitHub.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant